﻿<Window x:Class="JobBoardAdminPanel.Views.EditCountriesWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="EditCountriesWindow" Height="600" Width="900"
        >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="0,5*"/>
            <RowDefinition Height="0,5*"/>
        </Grid.RowDefinitions>
        
        <DataGrid ItemsSource="{Binding Countries}" AutoGenerateColumns="False" IsReadOnly="True"
                  CanUserAddRows="False"
                  SelectedItem="{Binding CurrentCountry}">
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding Id}"/>
                <DataGridTextColumn Header="CountryName" Binding="{Binding CountryName}"/>
            </DataGrid.Columns>
        </DataGrid>
        
        <Grid Grid.Row="1">
            <StackPanel>
                <TextBlock Text="EditItem" FontWeight="ExtraBold"/>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="ID: " Width="40"/>
                    <TextBlock Text="{Binding CurrentCountry.Id}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Name:" Width="40"/>
                    <TextBox Width="150" Text="{Binding CurrentCountry.CountryName}" />
                    <Button Name="ButtonSave" Content="Save" Command="{Binding SaveCommand}"/>
                    <Button Name="ButtonDelete" Content="Delete" Command="{Binding DeleteCommand}"/>
                </StackPanel>
                <TextBlock Text="InsertItem" FontWeight="ExtraBold"/>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Name:" Width="40"/>
                    <TextBox Width="150" Text="{Binding NewCountry.CountryName}" />
                    <Button Name="ButtonAdd" Content="Add" Command="{Binding AddCommand}"/>
                </StackPanel>
            </StackPanel>
            
            <Button Name="BackToMain" Content="Back to main" FontWeight="bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="50" Width="150" Click="BackToMain_Click"/>
        </Grid>
    </Grid>
</Window>
